package com.exam.online.system.dao;

import com.exam.online.system.entity.Student;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface StudentDAO {
    int deleteByPrimaryKey(Integer id);

    int insert(Student record);

    int insertSelective(Student record);

    Student selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(Student record);

    int updateByPrimaryKey(Student record);

    @Select("SELECT * FROM t_student WHERE `acount`=#{acount} AND `password`=#{password} and state=1")
    Student stuLoggin(@Param("acount") String acount, @Param("password") String password);

    @Select("select * from `t_student`")
    List<Student> selectAll();

    @Select("select * from `t_student` where  state=1 limit #{pageNo},#{pageSize}")
    List<Student> getAllStudent(@Param("pageNo") Integer pageNo, @Param("pageSize") Integer pageSize);

    @Select("select count(*) from `t_student` where state=1")
    Integer getAllStudentCout();

    @Select("select * from `t_student` where stu_num = #{stuNum}")
    Student selectByStuNum(@Param("stuNum") Integer stuNum);
}